package com.zwz.controller;

import com.zwz.entity.TaxpayerQuali;
import com.zwz.service.TaxpayerQualiService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/taxpayer-quali")
@RequiredArgsConstructor
public class TaxpayerQualiController {
    private final TaxpayerQualiService service;

    @PostMapping
    public ResponseEntity<Void> create(@RequestBody TaxpayerQuali entity) {
//        service.create(entity, String.valueOf(pk));
        return ResponseEntity.ok().build();
    }

    @DeleteMapping("/{id}")
    public ResponseEntity<Void> delete(@PathVariable Integer id) {
        service.delete(id);
        return ResponseEntity.ok().build();
    }

    @PutMapping
    public ResponseEntity<Void> update(@RequestBody TaxpayerQuali entity) {
        service.update(entity);
        return ResponseEntity.ok().build();
    }

    @GetMapping("/{id}")
    public ResponseEntity<TaxpayerQuali> getById(@PathVariable Integer id) {
        return ResponseEntity.ok(service.getById(id));
    }

    @GetMapping
    public ResponseEntity<List<TaxpayerQuali>> getAll() {
        return ResponseEntity.ok(service.getAll());
    }
}